package com.jingxi.controller;

import com.jingxi.common.pojo.EasyUIDataGridResult;
import com.jingxi.common.pojo.JingXiResult;
import com.jingxi.model.TbContent;
import com.jingxi.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping("/content")
public class ContentController {

    @Autowired
    ContentService contentService;

    @RequestMapping(value = "/query/list",method = RequestMethod.GET)
    @ResponseBody
    public EasyUIDataGridResult list(long categoryId, Integer page, Integer rows){
        return contentService.list(categoryId,page,rows);
    }
    @RequestMapping(value = "/save",method = RequestMethod.POST)
    @ResponseBody
    public JingXiResult save(TbContent tbContent){
        return contentService.save(tbContent);
    }
    // /rest/content/edit 前端url错误
    @RequestMapping(value = "/edit",method = RequestMethod.POST)
    @ResponseBody
    public JingXiResult updata(TbContent tbContent){
        return contentService.updata(tbContent);
    }
    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    @ResponseBody
    public JingXiResult delete(@RequestParam long ids){
        return contentService.delete(ids);
    }


}
